using UnityEngine;
using System.Collections;

public class GraphicClass : MonoBehaviour {

	// Use this for initialization
	public float fadeSpeed;
	public float startAlpha;
	public float endAlpha;
	
	public float scaleSpeed;
	public float startScale;
	public float endScale;
	
	private OTSprite self;	
	private globalVarsClass gv;	
	private bool suicide = false;
	
	
	void Start () {
		gv = GameObject.Find("GlobalVariables").GetComponent<globalVarsClass>();
		gv.graphicList.Add(this.gameObject.GetComponent<OTSprite>());
		self = this.GetComponent<OTSprite>();
		self.alpha = startAlpha;
		self.size = new Vector2(startScale, startScale);
	}
	
	public void deleteEffect(){
		suicide = true;
	}
	public bool moveMe(){
		self.alpha -= fadeSpeed;
		if(self.alpha < endAlpha){
			return true;
		}
		self.size = new Vector2(self.size.x-scaleSpeed, self.size.x-scaleSpeed);
		if(self.size.x < endScale){
			return true;
		}
		if(suicide){
			return true;
		}
		return false;
	}
	
	
	// Update is called once per frame
	void Update () {
	
	}
}
